<!DOCTYPE html>
<html>

<head>

	<link rel="stylesheet" href="../../lib/layui/css/layui.css">
	<link rel="stylesheet" href="../../css/oksub.css">
	<meta charset="utf-8">
	<title>催办列表页</title>
</head>
<style>
	.list-con {
		padding: 0 10px 15px 10px;
		margin-bottom: 20px;
	}

	.list-con .layui-table td,
	.layui-table-view,
	.layui-table[lay-skin=line],
	.layui-table[lay-skin=row] {
		border: none;
	}

	.list-con .layui-table tbody {
		color: #777777;
	}

	.list-con .layui-table tbody tr:hover,
	.layui-table[lay-even] tr:nth-child(even) {
		background-color: rgb(226, 226, 226);
		color: black;
		font-weight: bold;
	}

	.layui-table tr {
		border-bottom: 1px #e2e2e2 solid;
	}

</style>

<body>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
	<legend>处理警情</legend>
	<div style="z-index: 9999; position: fixed ! important; right:50px; top: 15px;">
	<div id="selectForm" style="float: right; margin-right:50px;" lay-event="search" class="layui-btn layui-btn-normal layui-btn-radius">
		<i class="layui-icon layui-icon-search"></i>
	</div>
	<div id="backAll" style="float: right; margin-right:10px;"
		 class="layui-btn layui-btn-normal layui-btn-radius" lay-event="backAll">
		刷新
	</div>
	</div>
</fieldset>
<!--数据表格-->
<div class="list-con">
	<table class="layui-hide" id="tableIds" lay-filter="tableIds"></table>
</div>


<div style="display: none;" id="urging">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>催办记录</legend>
	</fieldset>
	<!--数据表格-->
	<div class="list-con">
		<table class="layui-hide" id="tableId" lay-filter="tableId"></table>

	</div>
</div>
</body>
<script src="../../lib/layui/layui.js"></script>
<script src="../../js/jquery.min.js"></script>
<script src="../../js/application.js"></script>
<script src="../../js/model.js"></script>
<script>
	layui.use(["table", 'laydate', 'okLayer'], function () {
		let $ = layui.jquery;
		let table = layui.table;
		var form = layui.form,
				laydate = layui.laydate;
		let okLayer = layui.okLayer;
		$("#selectForm").on('click', selectForm)
		//搜索
		function selectForm() {
			okLayer.open("查询条件", "selectForm.html", "35%", "60%", function (layero) {
				let iframeWin = window[layero.find("iframe")[0]["name"]];
				//iframeWin.initForm(initData.internshipId);
			}, function () {
				//根据子页面传过来的查询参数进行查询
				var caseId = window.document.caseId;
				var procLevel = window.document.procLevel;
				var caseDescription = window.document.caseDescription;
				var startTime = window.document.startTime;
				var endTime = window.document.endTime;
				var newStartDate = startTime.replace(/-/g,"/");//时间格式转换
				var newEndDate = endTime.replace(/-/g,"/");
				//置空子页面搜索框
				window.document.caseId="";
				window.document.procLevel="";
				window.document.caseDescription="";
				window.document.startTime="";
				window.document.endTime="";
				var isChange=window.document.isChange;
				window.document.isChange=0
				if(isChange!=1){
					return
				}
				//重载页面
				articleTables.reload({
					url: mainUri + "/vCaseAskForList/selects",
					where: {
						'caseId':caseId,
						'procLevel':procLevel,
						'caseDescription':caseDescription,
						'procTatus':2,
						'startTime':newStartDate,
						'endTime':newEndDate,
					},
					page: {curr: 1}
				})
			})
		}
		//刷新
		$("#backAll").on('click', backAll)
		function backAll(){

			articleTables.reload({
				url: mainUri + "/VCaseProcInfoByPolice/getUrging",
				where: {
					'selectConditionJson':JSON.stringify(new SelectCaseUrgingCondition("","","","","",""))
				},
				page: {curr: 1}
			})
			document.getElementById("urging").style.display="none";
		}

        //处理中的案件数据绑定
		let articleTables = table.render({
			elem: "#tableIds",
			url: mainUri + "/VCaseProcInfoByPolice/getUrging",
			toolbar:true,
			where: {
				'selectConditionJson':JSON.stringify(new SelectCaseUrgingCondition("","","","","",""))
			},
			page: true,
			cols: [[
				{field: "processId", title: "指派编号", hide: true},
				{field: "caseId", title: "警情编号", width: 180},
				{field: "caseDescription", title: "警情描述", width: 600},
				{field: "procpoliceId", title: "处理者id", hide: true},
				{field: "departmentId", title: "处理者部门id", hide: true},
				{
					field: "remind", title: "提醒", width: 130, templet: function (d) {
						var returnStr = "";
						if (d.urging) {
							returnStr += '<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-warm" onclick="showUrging(\'' +
									d.processId+"\',\'"+d.caseId
									+ '\')" id="showUrging">' + '催办' + '</button>';
						}
						if (d.back) {
							returnStr += '<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-danger"  onclick="showBack(\'' +
									d.processId+"\',\'"+d.caseId
									+ '\')" id="showBack">' + '回退' + '</button>';
						}
						return returnStr
					}
				},
				{
					field: "procLevel", title: "督办级别", width: 90, templet: function (d) {
						if (d.procLevel == "一级") {
							return "<div style='color:#d92d29;font-weight: bold;font-size:15px'>" + d.procLevel + "</div>"
						} else if (d.procLevel == "二级") {
							return "<div style='color:#f09614;font-weight: bold;font-size:15px'>" + d.procLevel + "</div>"
						} else if (d.procLevel == "三级") {
							return "<div style='color:#fae600;font-weight: bold;font-size:15px'>" + d.procLevel + "</div>"
						} else{
							return "<div style='color:#478f43;font-weight: bold;font-size:15px'>" + d.procLevel + "</div>"
						}
					}
				},
				{field: "procperiod", title: "处理时长(日)", width: 110},
				{
					field: "askFullName", title: "分派者", templet: function (d) {
						return d.askFullName + "(" + d.askForDepartmentName + ")"
					}
				},
				{field: "askForTime", title: "分派时间", width: 155},
			]],
			page: {
				layout: ['prev', 'page', 'next', 'skip', 'count'],
				groups: 3,
				limit: 15,
				theme: '#1E9FFF',
			},
		});

		//监听双击事件  双击进入详细页面
		table.on('rowDouble(tableIds)', function (obj) {
			var data = obj.data;
			var uri = "processing.html?caseId=" + data.caseId + "&processId=" + data.processId;
			show(uri);
			//标注选中样式
			obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
		});
        //催办记录展示
		let articleTable = table.render({
			elem: "#tableId",
			url: "",
			limit: 20,
			cols: [[
				{field: "processId", title: "指派编号", hide: true},
				{field: "caseId", title: "警情编号", hide: true},
				{field: "caseDescription", title: "警情描述"},
				{field: "objFullName", title: "处理者",templet: function (d) {
						if (d.objFullName!=null&&d.objDepartment!=null){
							return d.objFullName + " | " + d.objDepartment
						}else if(d.objFullName==null&&d.objDepartment!=null){
							return d.objDepartment
						}else {
							return "暂未分派"
						}
					}},
				{field: "urgingContent", title: "催办内容"},
				{
					field: "urgingName", title: "催办者", templet: function (d) {
						return d.fullName + "(" +d.roleName+" | "+ d.urgingDepartment + ")"
					}
				},{field: "reviewContent", title: "回复内容",templet: function (d) {
					if(d.reviewContent==null){
						return "暂未回复"
					}else {
						return d.reviewContent
					}
					}},
				{
					field: "isRead", title: "是否已阅", width: 90, templet: function (d) {
						if (d.read==true) {
							return "是"
						} else {
							return "否"
						}
					}
				},
				{field: "state", title: "警情状态", hide: true}
			]]
		});
		//单击出现催办记录
		table.on('row(tableIds)', function (obj) {
			var data = obj.data;
			var id = data.caseId;
			var processid = data.processId;
			var url = null;
			document.getElementById("urging").style.display = "block";
			articleTable.reload({
				url: mainUri + "/vurging/selectVUrgings?processId="+processid
			})
		});

		//监听行单击事件
		table.on('row(tableId)', function (obj) {
			obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
		});
		//跳转详细页设置
		function show(uri) {
		    window.open(uri, 'newwindow', 'width=' + (window.screen.availWidth - 10) + ',height=' + (window.screen.availHeight - 30) + ', top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no')
		}
	})
</script>

</html>